/*
 * Created by JFormDesigner on Fri Oct 17 17:08:00 CST 2025
 */

package com.yeban.javase.day09;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * @author yeban
 */
public class MyFrame extends JFrame {

    public static void main(String[] args) {
        new MyFrame().setVisible(true);
    }

    public MyFrame() {
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        initComponents();
    }

    private void login(ActionEvent e) {
        // TODO add your code here
        JOptionPane.showMessageDialog(null , "看到我了。哈哈");
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        titleLabel = new JLabel();
        loginButton = new JButton();
        registerButton = new JButton();

        //======== this ========
        setResizable(false);
        setTitle("\u9996\u9875");
        Container contentPane = getContentPane();
        contentPane.setLayout(null);

        //---- titleLabel ----
        titleLabel.setText("\u767b\u9646\u754c\u9762");
        titleLabel.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 26));
        titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
        contentPane.add(titleLabel);
        titleLabel.setBounds(70, 30, 165, 55);

        //---- loginButton ----
        loginButton.setText("\u767b\u5f55");
        loginButton.addActionListener(e -> login(e));
        contentPane.add(loginButton);
        loginButton.setBounds(50, 205, 78, 34);

        //---- registerButton ----
        registerButton.setText("\u6ce8\u518c");
        contentPane.add(registerButton);
        registerButton.setBounds(170, 205, 78, 34);

        contentPane.setPreferredSize(new Dimension(305, 465));
        pack();
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    private JLabel titleLabel;
    private JButton loginButton;
    private JButton registerButton;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
